package com.imcode.setdemo;

public class HashCodeDemo {
    public static void main(String[] args) {
        String s1 = new String("Hello");
        String s2 = new String("Hello");

        System.out.println(s1.hashCode());
        System.out.println(s2.hashCode());
        System.out.println(s1.equals(s2));//true

        System.out.println("-------------------");
        Object obj1 = new Object();
        Object obj2 = new Object();
        System.out.println(obj1.hashCode());
        System.out.println(obj2.hashCode());
        System.out.println(obj1.equals(obj2));

        System.out.println("-------------------");
        Member member1 = new Member("张三");
        Member member2 = new Member("张三");

        System.out.println(member1.hashCode());
        System.out.println(member2.hashCode());
        System.out.println(member1.equals(member2));
    }
}
